/**
 * 
 */
package com.avecsys.quotemanager.dao.common;

import java.util.List;
import java.util.Map;

import com.avecsys.quotemanager.exception.DAOException;
import com.avecsys.quotemanager.pojos.BasePojo;

/**
 * @author sam sundar K
 * 
 */
public interface BaseDAO {

	/**
	 * Method to insert a new record
	 * 
	 * @param persistantPojo
	 * @return Integer status
	 * @throws DAOException
	 */
	public Integer save(final BasePojo persistantPojo) throws DAOException;

	/**
	 * Method to update an existing record
	 * 
	 * @param persistantPojo
	 * @return
	 * @throws DAOException
	 */
	public Integer update(final BasePojo persistantPojo) throws DAOException;

	/**
	 * Method to delete the persisted object
	 * 
	 * @param instance
	 * @return An Integer Status code value
	 * @throws DAOException
	 */
	public <T> Integer delete(final T instance) throws DAOException;

	/**
	 * Method to mark the record as delete with status 'D'
	 * 
	 * @param instance
	 * @return Integer
	 * @throws DAOException
	 */
	public <T> Integer markAsDeleted(final T instance) throws DAOException;

	public <T> T findById(T instance, Long Pk) throws DAOException;

	public <T> List findAll(T instance) throws DAOException;

	/**
	 * Method to get all active record instance
	 * 
	 * @param instance
	 * @return List of Persisted Instances
	 * @throws DAOException
	 */
	public <T> List findAllActive(T instance) throws DAOException;

	/**
	 * Method to find all active record instances based on criteria
	 * 
	 * @param instance
	 * @param criteria
	 * @return List
	 * @throws DAOException
	 */
	public <T> List findAllActiveByCriteria(T instance,
			Map<String, Object> criteria) throws DAOException;

}
